export CC = clang
export AR = llvm-ar

TARGET = server

INCLUDE = -I./include
SRC = ./app/server/server.c
OBJS = server.o
LIBS = -L./lib/db -L./lib/net -L./lib/ui -lui -ldb -lnet

.PHONY: all
all:
	cd lib && $(MAKE);
	$(MAKE) $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $^ -o $@ $(LIBS)

$(OBJS): $(SRC)
	$(CC) $(INCLUDE) -c $(SRC)

.PHONY: clean install uninstall

install: $(TARGET)
	cp $(TARGET) /usr/local/bin

uninstall: $(TARGET)
	-rm -f /usr/local/bin/$(TARGET)


clean:
	cd lib && $(MAKE) clean;
	-rm -f *.o

